package org.example.demo7;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.core.type.classreading.MetadataReader;
import org.springframework.core.type.classreading.MetadataReaderFactory;
import org.springframework.core.type.filter.AssignableTypeFilter;
import org.springframework.core.type.filter.TypeFilter;
import org.springframework.util.ClassUtils;

import java.io.IOException;
import java.util.Set;

@Slf4j
public class Main {
    public static void main(String[] args) {
        log.info("");
        ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true);
        scanner.addIncludeFilter(new AssignableTypeFilter(TargetInterface.class));//这个东西扫不出实现了TargetInterface的接口
        Set<BeanDefinition> candidateComponents = scanner.findCandidateComponents("org.example.demo7");
        log.info("");
        for (BeanDefinition beanDefinition : candidateComponents) {
            System.out.println(beanDefinition);
        }
    }
}
